/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package util;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;

/**
 *
 * @author 乐山
 */
public class GradeExcelReader {
    public static Workbook readWorkbookFromExcelFile(String fileName){
        try(InputStream inp = new FileInputStream(fileName)){
            Workbook wb = WorkbookFactory.create(inp);
            return wb;
        } catch (FileNotFoundException ex) {
            Logger.getLogger(GradeExcelReader.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(GradeExcelReader.class.getName()).log(Level.SEVERE, null, ex);
        }
        return null;
    }
}
    
